package com.android.tea;

import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.ProgressBar;

public class WelcomeActivity extends Activity {
	private ProgressBar progressBar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.startup);
		progressBar = (ProgressBar)findViewById(R.id.progressBar1);
		
		startup();
	}

	private void startup() {
		new AsyncTask<Void, Integer, Long>() {

			@Override
			protected Long doInBackground(Void... params) {
				try {
					Thread.sleep(1500);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				return null;
			}

			@Override
			protected void onPostExecute(Long result) {
				progressBar.setVisibility(View.GONE);
				Intent intent = new Intent(WelcomeActivity.this,BaseTabActivity.class);
				startActivity(intent);
				finish();
				super.onPostExecute(result);
			}

			@Override
			protected void onPreExecute() {
				progressBar.setVisibility(View.VISIBLE);
				super.onPreExecute();
			}
			
			
		}.execute();
		
	}
}
